import request from '@/utils/request'
import { getServicePath } from '@/api/baseUrlConfig'
const servicePath = getServicePath()

export function getList (data) {
  return request({
    url: servicePath.gzMetroMetroProjectServer + '/constructionScheme/getSchemeList',
    method: 'post',
    data
  })
}

// 获取设计方案统计
export function getStatistics (params) {
  return request({
    url: servicePath.gzMetroMetroProjectServer + '/constructionScheme/statistics',
    method: 'get',
    params
  })
}

// 获取详情
export function getDetail (params) {
  return request({
    url: servicePath.gzMetroMetroProjectServer + '/constructionScheme/getDetail',
    method: 'get',
    params
  })
}

// 获取审批进度列表
export function getApprovalList (data) {
  return request({
    url: servicePath.gzMetroMetroProjectServer + '/constructionScheme/getList',
    method: 'post',
    data
  })
}

// 获取方案历史记录
export function getSchemeHistory (params) {
  return request({
    url: servicePath.gzMetroMetroProjectServer + '/constructionScheme/getSchemeHistory',
    method: 'get',
    params
  })
}

// 保存草稿
export function saveDraft (data) {
  return request({
    url: servicePath.gzMetroMetroProjectServer + '/constructionScheme/saveDraft',
    method: 'post',
    headers: {
      showLoading: true
    },
    data
  })
}

// 发布
export function release (data) {
  return request({
    url: servicePath.gzMetroMetroProjectServer + '/constructionScheme/release',
    method: 'post',
    headers: {
      showLoading: true
    },
    data
  })
}

// 编辑审批情况
export function updApprovalInfo (data) {
  return request({
    url: servicePath.gzMetroMetroProjectServer + '/constructionScheme/updApprovalInfo',
    method: 'post',
    headers: {
      showLoading: true
    },
    data
  })
}

// 获取模型信息
export function getModuleById (params) {
  return request({
    url: servicePath.workFlowServer + '/module/getModuleById',
    method: 'get',
    params
  })
}

// 获取流程图片
export function picture (params) {
  return request({
    url: servicePath.workFlowServer + '/workflow/picture',
    method: 'get',
    responseType: 'blob',
    params
  })
}

// 获取流程审批信息
export function getProcessHistory (params) {
  return request({
    url: servicePath.workFlowServer + '/workflow/getProcessHistory',
    method: 'get',
    params
  })
}

export function download (id) {
  return request({
    url: `/bp-file-server/file/download/${id}`,
    headers: {
      showLoading: true
    },
    method: 'get',
    responseType: 'blob'
  })
}
